

  /*
 
	use SIZE_CBGB_DATA2020     , clear
	 
	keep if year(st0_date) == 2016  &  month(st0_date) == 3  // keep 1 months only: June 2016
     
	keep   price* price_d* instrumentid quantity st0_date     call coun instrumentid ///
	N_aver N_coun   N_3hour N_BuSe N_IDB  activeZ agency ave_C_N_aver D4_NEWS
	  
	cap drop aux*
    gen aux2 =  rnormal(0,2)  // randomise quantities
    gen aux3 =  runiform()    // randomise direction of trades

	replace quantity = quantity + 100*aux2  // random quantity
	gen bs_clients = -1  				  // random trade direction
	replace bs_clients =  1 if aux3 > 0.5 // random trade direction
		foreach j of varlist price* N_* {
			cap drop aux
		    gen aux  =  rnormal(0,2)   // randomise prices and costs
			replace `j' = `j' + aux 		    // random prices and costs
	}
	
	
	cap drop aux*
	compress
 	 
  cap drop size
 gen size = log(quantity )  
 
 cap drop aux*
 gen auxY = year(st0_date)
 gen auxM = month(st0_date)
 
 egen mm = group(auxY auxM)
  cap drop aux*

     save RFS_master_data, replace
	 */
	 
	 
	  
	 
	   /*
  The variables are:
   "price" 		 			 - transaction price
   "instrumentid" 			 - numerical id for each ISIN
   "st0_date" 	 	 		 - transation date
   "call" 					 - numerical id for counterparty 1 [cliens]
   "coun" 					 - numerical id for counterparty 2 [dealers]
   "quantity" 				 - size of trade
   "bs_clients"  			 - buy-sell dummy (+1 --> buy; -1 --> sell)
   "price_d0, price_d1..."   - benchmark price, 0, 1... days ahead
   "N_aver" 				 - transaction cost measure (BASELINE)
   "N_coun" 				 - transaction cost measure (alternative 1: dealer-specific average)
   "N_3hour" 				 - transaction cost measure (alternative 2: baseline with 3 daily time window)
   "N_BuSe" 				 - transaction cost measure (alternative 3: baseline seperately for buys and sells)
   "N_IDB" 					 - transaction cost measure (alternative 4: baseline with IDB average price used benchmark
   "agency"				     - trade type [1 agency, 0 non-agency]
   "activeZ"				 - dummy for client type [0 - less sophisticated, 1 - more sophisticated]
   "ave_C_N_aver"			 - average transaction cost measure (BASELINE)
   "D4_NEWS"				 - indicator:   4 --> more sophisticated, bigger news 
											3 --> more sophisticated, smaller news 
											2 --> less sophisticated, bigger news 
											1 --> less sophisticated, smaller news  
   
  */
	  
